20/08/24
MF-PADs plotted from VM's recon, using matrix method from Gregory et al. (https://iopscience.iop.org/article/10.1088/1361-6455/ac135f/meta).
# Load raw data
from scipy.io import loadmat
betaIn = loadmat('betasMF_Astate.mat')
thetaIn = loadmat('theta.mat')
# Convert to Xarray
import numpy as np
import epsproc as ep
from epsproc.sphCalc import setBLMs
# BLM = setBLMs(betaIn['beta'], dimNames=['BLM','tPol'], t=np.linspace(0,np.pi,100).round(3), tUnits='Rad') # v1
BLM = setBLMs(betaIn['beta'], dimNames=['BLM','tPol'], t=thetaIn['theta'].squeeze().round(3), tUnits='Rad') # v2 with theta
OMP: Info #276: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead.
* sparse not found, sparse matrix forms not available. * natsort not found, some sorting functions not available.
* Setting plotter defaults with epsproc.basicPlotters.setPlotters(). Run directly to modify, or change options in local env.
* Set Holoviews with bokeh. * pyevtk not found, VTK export not available.
# Add conjugate pairs (L,-M)
# Note existing function uses Yl,m = conj((-1)^m * Yl,-m)
# Cf. VM conj: beta_{LM} = (-1)^(L - M) * beta_{L-M}, but doesn't matter in this case.
from epsproc.sphFuncs import sphConv
BLMconj = sphConv.sphConj(BLM)
# Merge data
# BLMfull = BLM + BLMconj.where(BLMconj.m<0)
# BLMfull
BLMfull = BLM.combine_first(BLMconj.where(BLMconj.m<0))
# BLMconj.where(BLMconj.m<0)
BLMfull = sphConv.cleanLMcoords(BLMfull)
from epsproc.util.conversion import renormL0
BLMfullNorm = renormL0(BLMfull)
NOTE: interactive plot, but ignore unphysical terms in legend (e.g. (0,-2) etc.), this is just a plotter label bug.
# Check BLMs - plot looks OK, aside from added terms with M>L! Issue with unstack here...
# Set some plot options
imgWidth = 1000
imgHeight = 600
ep.plot.hvPlotters.setPlotters(width=imgWidth, height=imgHeight)
plotBackend='hv'
# Plot - unnorm
# ep.BLMplot(BLMfull, xDim='tPol', backend=plotBackend, thres=0.1)
# ep.BLMplot(sphConv.cleanLMcoords(BLMfull.unstack()), xDim='tPol', backend=plotBackend)
# Plot - renorm
ep.BLMplot(BLMfullNorm, xDim='tPol', backend=plotBackend, thres=0.1)
* Set Holoviews with bokeh.
# Plot some PADs from BLMs
# Set the backend to 'pl' for an interactive surface plot with Plotly
# Explict row,column layout setting for figure
rc = [3,5]
# Compute expansions from BLM parameters and return figure objext
plotBackend='pl'
dataPlot, figObj = ep.sphFromBLMPlot(BLMfullNorm.sel(tPol=slice(0,np.pi,8)), facetDim='tPol', backend = plotBackend, rc=rc, #, returnFlag=True);
plotFlag=True,height=1000, width=1200)
# figObj[0]
Using complex betas (from BLMX array). *** WARNING: plot dataset has min value < 0, min = (-0.743125240391105+0j). This may be unphysical and/or result in plotting issues. Sph plots: Plotting with facetDims=tPol, pType=a with backend=pl. *** Plotting for [1,1,0] *** Plotting for [1,2,1] *** Plotting for [1,3,2] *** Plotting for [1,4,3] *** Plotting for [1,5,4] *** Plotting for [2,1,5] *** Plotting for [2,2,6] *** Plotting for [2,3,7] *** Plotting for [2,4,8] *** Plotting for [2,5,9] *** Plotting for [3,1,10] *** Plotting for [3,2,11] *** Plotting for [3,3,12] *** Plotting for [3,4,13] *** Plotting for [3,5,13]
# # Try class version, better plotter...
# plotBackend='pl'
# # Explict row,column layout setting for figure
# rc = [3,5]
# # Example using data class
# from pemtk.fit.fitClass import pemtkFit
# data = pemtkFit()
# # Set data in class, and plot PADs
# data.setData('X', BLMfullNorm)
# data.padPlot(keys = 'X', dataType='AFBLM', Etype='tPol', selDims={'tPol':slice(0,np.pi,8)}, backend=plotBackend,
# rc = rc, height=1000, width=1200)
# data.BLMplot(keys = 'X', Etype='tPol', xDim='tPol', backend='hv')
import scooby
scooby.Report(additional=['epsproc', 'holoviews', 'hvplot', 'xarray', 'matplotlib', 'bokeh'])
| Wed Aug 21 11:55:26 2024 EDT | |||||||
| OS | Linux | CPU(s) | 64 | Machine | x86_64 | Architecture | 64bit |
| RAM | 62.8 GiB | Environment | Jupyter | File system | btrfs | ||
| Python 3.10.11 | packaged by conda-forge | (main, May 10 2023, 18:58:44) [GCC 11.3.0] | |||||||
| epsproc | 1.3.2-dev | holoviews | 1.16.2 | hvplot | 0.8.4 | xarray | 2022.3.0 |
| matplotlib | 3.5.3 | bokeh | 3.1.1 | numpy | 1.23.5 | scipy | 1.10.1 |
| IPython | 8.13.2 | scooby | 0.7.2 | ||||
# Check current Git commit for local ePSproc version
from pathlib import Path
!git -C {Path(ep.__file__).parent} branch
!git -C {Path(ep.__file__).parent} log --format="%H" -n 1
* 3d-AFPAD-dev
dev
master
38f0b8a210146743906c7ef19f508d9035d096fd
# Check current remote commits
!git ls-remote --heads https://github.com/phockett/ePSproc
8c9201fdcb98f42875730b94282f50328decab8a refs/heads/3d-AFPAD-dev 7e4270370d66df44c334675ac487c87d702408da refs/heads/dev 1c0b8fd409648f07c85f4f20628b5ea7627e0c4e refs/heads/master 69cd89ce5bc0ad6d465a4bd8df6fba15d3fd1aee refs/heads/numba-tests ea30878c842f09d525fbf39fa269fa2302a13b57 refs/heads/revert-9-master baf0be0c962e8ab3c3df57c8f70f0e939f99cbd7 refs/heads/testDev